import { HttpClient } from "@angular/common/http";
import { Component, OnDestroy, OnInit, ViewChild } from "@angular/core";
import { GeneralSituationServices } from "./services/generalSituation.service";
import { IncomeData } from "./type";


@Component({
    selector: 'passport-login',
    templateUrl: './generalSituation.component.html',
    styleUrls: ['./generalSituation.component.less'],
  })
  export class generalSituationComponent implements OnInit, OnDestroy {
    radioValue  = '1';
    incomData:IncomeData = {
      allIncome:0,
      sealSingleCount:0.00,
      rechargeCount:0.00,
      customerPrice:0.00
    }
    constructor(private gss :GeneralSituationServices) {
    }

    ngOnInit(): void {
      this.getIncomeData()
    }
    
    getIncomeData():void{
      this.gss.geIncometData(this.radioValue).subscribe((res)=>{
        console.log(res)
        if(res.code===0){
             this.incomData = res.data
             console.log(res.data)
        }
    })
    }

    typeChange(a:any){
       this.getIncomeData()
    }

    ngOnDestroy(): void {
      
    }

  }